package com.mz361.common.utils;

import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

@Service
public class QueryCompanyUtil {

    public String queryCompanyData(String param) {
        String url = "https://cardnotwo.market.alicloudapi.com/companyQuery";
        String appcode = "1999e3b47f1847e7a4b25d49ca9c6c11";
        Map<String, String> headers = new HashMap<String, String>();
        //最后在header中的格式(中间是英文空格)为Authorization:APPCODE 83359fd73fe94948385f570e3c139105
        headers.put("Authorization", "APPCODE " + appcode);
        //根据API的要求，定义相对应的Content-Type
        headers.put("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
        Map<String, String> querys = new HashMap<String, String>();
        Map<String, String> bodys = new HashMap<String, String>();
        bodys.put("com", param);
        bodys.put("X_Ca_Error_Code", "OFF");
        return HttpServletUtil.sendPostRequestByForm(url, bodys, headers);

    }


}
